import req from '@/http/http'
import {getServer} from '@/http/AppApi'

let ZHPQ_SERVER = getServer()

// 积分类型
// 修改
export const updateIntegral = data => {
  let path = ZHPQ_SERVER + '/scoreType/' + data.id
  return req.put(path, data)
}
// 删除
export const delIntegral = data => {
  let path = ZHPQ_SERVER + '/scoreType/' + data.id
  return req.delete(path)
}
// 获取 查询 分页
export const findIntegral = param => {
  let path = ZHPQ_SERVER + '/scoreType'
  return req.get(path, param)
}
// 新增
export const createIntegral = data => {
  let path = ZHPQ_SERVER + '/scoreType/'
  return req.post(path, data)
}
// 个人积分
// 个人积分变动
export const personalIntegralChange = data => {
  let path = ZHPQ_SERVER + '/score/change/user'
  return req.post(path, data)
}
// 个人积分列表
export const findPersonalIntegral = param => {
  let path = ZHPQ_SERVER + '/score/user'
  return req.get(path, param)
}
// 获取积分分类列表
export const findIntegralTypeList = gradeType => {
  let path = ZHPQ_SERVER + '/scoreType/getByGradeType?gradeType=' + gradeType
  return req.get(path)
}
// 获取部门积分变更明细
export const findDeptIntegralDetail = data => {
  let path = ZHPQ_SERVER + '/scoreLog/dept'
  return req.get(path, data)
}
// 获取个人积分变动明细
export const findPersonalIntegralDetail = data => {
  let path = ZHPQ_SERVER + '/scoreLog/user'
  return req.get(path, data)
}
// 获取积分部门树
export const getIntegralDeptTree = _ => {
  let path = ZHPQ_SERVER + '/score/deptTree'
  return req.get(path)
}
// 部门积分列表
export const findDeptIntegral = param => {
  let path = ZHPQ_SERVER + '/score/dept'
  return req.get(path, param)
}
// 部门积分变动
export const deptIntegralChange = data => {
  let path = ZHPQ_SERVER + '/score/change/dept'
  return req.post(path, data)
}
// 部门积分类型分析
export const findDeptIntegralAnalysis = param => {
  let path = ZHPQ_SERVER + '/scoreAnalysis/dept'
  return req.get(path, param)
}
// 个人积分类型分析
export const findUserIntegralAnalysis = param => {
  let path = ZHPQ_SERVER + '/scoreAnalysis/user'
  return req.get(path, param)
}
// 个人积分类型文件导出
export const personalIntegralFileExport = param => {
  let path = ZHPQ_SERVER + '/scoreAnalysis/user/exportExcel'
  return req.get(path, param)
}
// 获取文件导出接口
export const getExportFileUrl = isdept => {
  let path = isdept ? ZHPQ_SERVER + '/scoreAnalysis/dept/exportExcel' : ZHPQ_SERVER + '/scoreAnalysis/user/exportExcel'
  return path
}
// 获取导出明细接口
export const getExportDetailUrl = _ => {
  let path = ZHPQ_SERVER + '/scoreAnalysis/user/exportExcel/daily'
  return path
}
